﻿using LightingPlatform.Tools;
using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace LightingPlatform.ViewModel
{
    public class LightingQueryVM : NotifyingObject
    {
        private uint _usePlace;
        private uint _productClass;
        private uint _lightingSourceClass;
        private uint _setup;
        private string _lightingTemperature;
        private string _cri;
        private string _angle;
        private string _series;
        private string _productVersion;
        private string _productLable;
        private string _startLightingPower;
        private string _startMarketPrice;
        private string _endLightingPower;
        private string _endMarketPrice;

        public string Series
        {
            get { return _series; }
            set { _series = value; }
        }

        public uint UsePlace
        {
            get { return _usePlace; }
            set { _usePlace = value; }
        }

        public uint ProductClass
        {
            get { return _productClass; }
            set { _productClass = value; }
        }

        public string ProductVersion
        {
            get { return _productVersion; }
            set { _productVersion = value; }
        }

        public string ProductLable
        {
            get { return _productLable; }
            set { _productLable = value; }
        }

        public uint LightingSourceClass
        {
            get { return _lightingSourceClass; }
            set { _lightingSourceClass = value; }
        }


        public uint Setup
        {
            get { return _setup; }
            set { _setup = value; }
        }

        public string StartLightingPower
        {
            get { return _startLightingPower; }
            set { _startLightingPower = value; }
        }

        public string LightingTemperature
        {
            get { return _lightingTemperature; }
            set { _lightingTemperature = value; }
        }

        public string Cri
        {
            get { return _cri; }
            set { _cri = value; }
        }

        public string Angle
        {
            get { return _angle; }
            set { _angle = value; }
        }

        public string StartMarketPrice
        {
            get { return _startMarketPrice; }
            set { _startMarketPrice = value; }
        }

        public string EndLightingPower
        {
            get { return _endLightingPower; }
            set { _endLightingPower = value; }
        }

        public string EndMarketPrice
        {
            get { return _endMarketPrice; }
            set { _endMarketPrice = value; }
        }

        public LightingQuery ConvertTo()
        {
            LightingQuery.Builder builder = new LightingQuery.Builder();

            if (!string.IsNullOrEmpty(_series))
                builder.SetSeries(_series);

            if (_usePlace > 0)
                builder.SetUsePlace(_usePlace);

            if (_productClass > 0)
                builder.SetProductClass(_productClass);

            if (!string.IsNullOrEmpty(_productLable))
                builder.SetProductLable(_productLable);

            if (!string.IsNullOrEmpty(_productVersion))
                builder.SetProductVersion(_productVersion);

            if (_lightingSourceClass > 0)
                builder.SetLightingSourceClass(_lightingSourceClass);

            if (_setup > 0)
                builder.SetSetup(_setup);

            if (!string.IsNullOrEmpty(_startLightingPower))
                builder.SetStartLightingPower(_startLightingPower);
            if (!string.IsNullOrEmpty(_endLightingPower))
                builder.SetEndLightingPower(_endLightingPower);

            if (!string.IsNullOrEmpty(_lightingTemperature))
                builder.SetStartTemperature(_lightingTemperature);

            if (!string.IsNullOrEmpty(_cri))
                builder.SetStartCri(_cri);

            if (!string.IsNullOrEmpty(_angle))
                builder.SetStartAngle(_angle);

            if (!string.IsNullOrEmpty(_startMarketPrice))
                builder.SetStartMarketPrice(_startMarketPrice);
            if (!string.IsNullOrEmpty(_endMarketPrice))
                builder.SetEndMarketPrice(_endMarketPrice);
            return builder.Build();
        }
    }
}
